Upload into experiments, store file outputs, issue sample IDs #109
+4,383
−59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Legacy MAX-phase XRD data from the Anasori lab (needed by Prof. Bilionis's group) must be modelled the way Prof. Strachan asked on 2026-10-08: each step is a unit process, linked through the sample. A furnace synthesis run produces a sample; an XRD run takes that sample and outputs its pattern.
What
POST /api/data/uploads/{id}/processacceptsexperiment_type_id. Runs record the experiment (equipment_runs.experiment_type_id) and the template version they were captured under (experiment_type_version, kept on re-processing).GET /api/dataset/v2/runs?experiment_type_id=filters by it.POST /api/data/uploads/{id}/attachmentsstages files or a zip. At processing, outputs typedfile/artifactare matched by the path in the CSV cell and stored per run (equipment_run_files, Postgres bytea, as the model registry does). Download viaGET /api/dataset/v2/runs/{run_id}/files/{file_id}, scoped to the run's project.api/sample_ids.py. Asample_idoutput gets the ID derived from the run (equipment, project, lot, run instant, field); students can't invent IDs. Asample_idinput must name a sample already registered in the same project. Runs link to samples (equipment_run_samples), andGET /api/dataset/v2/samples/{id}/lineagefollows a sample across unit processes. Registering the namespace with DataCite/SESAR for global IGSN resolution is a follow-up.sample_idtype.scripts/legacy_xrd. The converter splits the lab's exports intosynthesis.csv,xrd.csvandpatterns.zip, using the platform's sample-ID function. Batch 1 (38 scans) validates end-to-end against the upload parser.Migration
ensure_upload_experiment_and_run_files_pg()(inrun_schema_migrations):equipment_runsand one todata_uploads(metadata-only adds);CREATE INDEX CONCURRENTLYand repairs an invalid one;data_upload_files,equipment_run_filesandequipment_run_sampleswith RLS policies.Run the migration Job before rolling out the API, as usual.
Tests
next buildpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ve21T1az57p9vrmYj8vdNe